package com.jcfriends.common.manager;

import javax.servlet.http.HttpServletRequest;

import org.springframework.ui.ModelMap;

public class ModelMapManager {

	/**\
	 * 파라미터가 있는 포워드
	 * @param map
	 * @param action
	 * @param method
	 * @param req
	 * @return
	 */
	public static ModelMap setModelMap(ModelMap map, String action, String method, HttpServletRequest req){

		map.addAttribute("FORWAD_ACTION", action);
		map.addAttribute("FORWAD_METHOD", method);
		
		if(req != null){
//			Enumeration en = req.getParameterNames();
//			
//			while(en.hasMoreElements()){
//				String paramName = en.nextElement().toString();
//				
//				System.out.println("\t param(key = value) : " + paramName + " = " + req.getParameter(paramName));
//			}
		}
		
		return map;
	}
	
	/**
	 * 파라미터 없는 포워드
	 * @param map
	 * @param action
	 * @param method
	 * @return
	 */
	public static ModelMap setModelMap(ModelMap map, String action, String method){
		return setModelMap(map, action, method, null);
	}
}
